var barChart = document.getElementById('barChart');
var GLbar = echarts.init(barChart);
var month = ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'];
var year = ['2017年', '2018年'];

var data = [[0, 0, 5], [0, 1, 1], [0, 2, 10], [0, 3, 9], [0, 4, 5], [0, 5, 5], [0, 6, 3], [0, 7, 4], [0, 8, 7], [0, 9, 5], [0, 10, 6], [0, 11, 2],
[1, 0, 7], [1, 1, 4], [1, 2, 3], [1, 3, 7], [1, 4, 8], [1, 5, 5], [1, 6, 2], [1, 7, 4], [1, 8, 7], [1, 9, 5], [1, 10, 5], [1, 11, 2]]
GLbarOption = {
    tooltip: {
        triggle: 'item',
        formatter: function(vm) {
            return year[vm.value[1]] + month[vm.value[0]] + '<br>放贷额度: ' + vm.value[2]
        }
    },
    visualMap: {
        max: 20,
        inRange: {
            color: ['#313695', '#4575b4', '#74add1', '#abd9e9', '#e0f3f8', '#ffffbf', '#fee090', '#fdae61', '#f46d43', '#d73027', '#a50026']
        }
    },
    title: {
        left: 'center',
        text: '历年每月放贷额度'
    },
    xAxis3D: {
        type: 'category',
        data: month
    },
    yAxis3D: {
        type: 'category',
        data: year
    },
    zAxis3D: {
        type: 'value'
    },
    grid3D: {
        boxWidth: 200,
        boxDepth: 80,
        viewControl: {
            // projection: 'orthographic'
        },
        top: '-5%',
        light: {
            main: {
                intensity: 1.2,
                shadow: true
            },
            ambient: {
                intensity: 0.3
            }
        }
    },
    series: [{
        type: 'bar3D',
        data: data.map(function (item) {
            return {
                value: [item[1], item[0], item[2]],
            }
        }),
        shading: 'lambert',

        label: {
            textStyle: {
                fontSize: 16,
                borderWidth: 1
            }
        },

        emphasis: {
            label: {
                textStyle: {
                    fontSize: 20,
                    color: '#900'
                }
            },
            itemStyle: {
                color: '#900'
            }
        },
        animation: true,
        animationDurationUpdate: 2800,
        animationEasingUpdate: 'quadraticOut'
    }]
}
GLbar.setOption(GLbarOption);